package com.tping.thread;

import java.util.ArrayList;
import java.util.List;
import java.util.concurrent.CopyOnWriteArrayList;
import java.util.concurrent.CyclicBarrier;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.FutureTask;

public class CallableTest {


    public static void main(String[] args){

        int size = 5;
        List<String> tasks = new CopyOnWriteArrayList<>();
        CyclicBarrier cb = new CyclicBarrier(size, () -> {
            for (String task : tasks){
                System.out.println(task);
            }
        });
        for (int i = 0; i < size; i++) {
            new Thread(new CyclicThread(cb, tasks, "AOP" + i)).start();
        }

        System.out.println("main 行程执行完毕");

    }

}
